<html>
<head>
<p>y=5,x=y+2</p>
<button type="button" onclick="myFunction()">Calculate</button>
<p id="demo">
</head>
<body>
<script>
	function myFunction()
	{
		var y=5,x=y+2;
		var demoP=document.getElementById("demo");
		demoP.innerHTML="x="+x;
	}
</script>
</body>

</html>